package com.css.zfzx.fwsjcj.modules.reinforce.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.css.zfzx.fwsjcj.modules.reinforce.entity.FwReinforceEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @author leon
 * @Title:
 * @Description: 新建工程导出VO
 * @date 2020/9/7 14:32
 */
@Data
public class NewProjectVO {
    /**
     * 工程编号
     */
    @Excel(name = "工程编号", width = 15)
    private String number;
    /**
     * 加固工程名称
     */
    @Excel(name = "工程名称", width = 15)
    private String name;
    /**
     * 省
     */
    @Excel(name = "省", width = 15)
    private String province;
    /**
     * 市
     */
    @Excel(name = "市", width = 15)
    private String city;
    /**
     * 区县
     */
    @Excel(name = "区县", width = 15)
    private String area;
    /**
     * 经度
     */
    @Excel(name = "经度", width = 15)
    private String longitude;
    /**
     * 纬度
     */
    @Excel(name = "纬度", width = 15)
    private String latitude;
    /**
     * 工程地址
     */
    @Excel(name = "工程地址", width = 15)
    private String address;
    /**
     * 工程类别
     */
    @Excel(name = "工程类别", width = 15)
    private String category;
    /**
     * 工程类别其他补充
     */
    @Excel(name = "工程类别其他补充", width = 15)
    private String categorySupplement;
    /**
     * 工程类型（一级选项）
     */
    @Excel(name = "工程类型", width = 15)
    private String type;
    /**
     * 工程类型(二级选项)
     */
    @Excel(name = "工程类型(二级选项)", width = 15)
    private String typeSecond;
    /**
     * 工程类型为其他时补充
     */
    @Excel(name = "工程类型其他补充", width = 15)
    private String typeSupplement;
    /**
     * 加固措施
     */
    @Excel(name = "加固措施", width = 15)
    private String measure;
    /**
     * 加固措施其他补充
     */
    @Excel(name = "加固措施其他补充", width = 15)
    private String measureSupplement;
    /**
     * 加固工程时为：工程完成时间 新建工程时为：竣工时间 （批注：公用字段，展示含义不太一样）
     */
    @Excel(name = "完成时间", width = 15)
    private String reinforceTime;
    /**
     * 抗震设防情况:6-9度（选项）
     */
    @Excel(name = "抗震设防情况", width = 15)
    private String fortificationIntensity;
    /**
     * 状态：0未提交，1待审核，2审核不通过，3审核通过
     */
    @Excel(name = "审核状态", replace = {"未提交_0", "待审核_1", "审核未通过_2", "审核通过_3"}, width = 15)
    private String status;

    /**
     * FwReinforceEntity转换为NewProjectVO
     *
     * @param reinforceEntity
     * @return
     */
    public static NewProjectVO change2ReinforceVO(FwReinforceEntity reinforceEntity) {
        NewProjectVO newProjectVO = new NewProjectVO();
        BeanUtils.copyProperties(reinforceEntity, newProjectVO);
        return newProjectVO;
    }

    /**
     * 集合转换
     *
     * @param fwReinforceEntities
     * @return
     */
    public static ArrayList<NewProjectVO> change2ReinforceVO(List<FwReinforceEntity> fwReinforceEntities) {
        ArrayList<NewProjectVO> list = new ArrayList<>();
        for (FwReinforceEntity re : fwReinforceEntities) {
            NewProjectVO newProjectVO = change2ReinforceVO(re);
            list.add(newProjectVO);
        }
        return list;
    }

    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        System.out.println(sdf.format(new Date()));
        new ArrayList<>();
        new HashMap<String, String>();
    }
}
